// api.js
import axios from 'axios';
const baseUrl = `http://127.0.0.1:54321`;

export const get = (url, params) => {
    return new Promise((resolve, reject) => {
        axios.get(baseUrl+url, { params })
            .then(response => {
                resolve(response.data);
            })
            .catch(error => {
                reject(error);
            });
    });
};

export const post = (url, data) => {
    return new Promise((resolve, reject) => {
        axios.post(baseUrl+url, data)
            .then(response => {
                resolve(response.data);
            })
            .catch(error => {
                reject(error);
            });
    });
};
